/*
struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
	TreeNode(int x) :
			val(x), left(NULL), right(NULL) {
	}
};*/
class Solution {
public:
    vector<int> PrintFromTopToBottom(TreeNode *root) {
    	vector<int> output;
    	if(root)
    		queue.push_back(root);
    	while(!queue.empty())
    	{
    		TreeNode *cur = queue.front();
    		queue.pop_front();
    		output.push_back(cur->val);
    		if(cur->left)
    			queue.push_back(cur->left);
    		if(cur->right)
    			queue.push_back(cur->right);
    	}
    	return output;
    }
private:
	deque<TreeNode*> queue;
};